
from whiff.resources import inMemorySession
from whiff import resolver
from whiff.middleware import displayTraceback
import format

sessionFinder = inMemorySession.memorySessionFinder(timeout=600) # 10 minute timeout

testapp = resolver.moduleRootApplication("/", format,
                                         #exception_middleware=None,
                                         exception_middleware=displayTraceback.__middleware__,
                                         on_not_found=None, # show traceback (could comment)
                                         )

testapp.registerResourceFinder(prefix="session", finder=sessionFinder)


if __name__=="__main__":
    import wsgiref.simple_server
    print "test layout page at http://localhost:8888/testLayout1"
    print "another test layout page at http://localhost:8888/testLayout2"
    print "serving wsgi chat test at 8888"
    srv = wsgiref.simple_server.make_server('localhost', 8888, testapp)
    srv.serve_forever()
                    
